#include <stdio.h>  
#include <string.h>  
  
void bruteForce(char* pattern, char* text) {  
    int M = strlen(pattern);  
    int N = strlen(text);  
    int i, j;  
    for (i = 0; i <= N - M; i++) {  
        for (j = 0; j < M; j++) {  
            if (pattern[j] != text[i + j]) {  
                break;  
            }  
        }  
        if (j == M) {  
            printf("Pattern found at index %d\n", i);  
        }  
    }  
}  
  
int main() {  
    char pattern[] = "ABC";  
    char text[] = "XYZABCDEFG";  
    bruteForce(pattern, text);  
    return 0;  
}